package cn.btks.zuulserver.feign.service.backmanage;

import cn.btks.commonserver.result.ResultState;
import cn.btks.zuulserver.feign.config.FeignConfig;
import cn.btks.zuulserver.feign.fallback.backmanage.BackManageClientFallBack;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;

/**
 * @Author lijun
 * @Date 2021/1/11 19:54
 */
//@FeignClient(value = "manage-server",url = "${feignUrl.url}",fallback = BackManageClientFallBack.class,configuration = FeignConfig.class)
@FeignClient(value = "manage-server", fallback = BackManageClientFallBack.class, configuration = FeignConfig.class)
public interface BackManageClient {

    /**
     * 根据ID获取用户信息
     *
     * @return
     */
    @GetMapping("api/v1.0/user/findById/{id}")
    public ResultState findById(@PathVariable("id") Long id);

    /**
     * 根据用户名获取用户信息
     *
     * @return
     */
    @GetMapping("api/v1.0/user/findByUserName/{userName}")
    public ResultState findByUserName(@PathVariable("userName") String userName);

    /**
     * 查询资源列表
     *
     * @return
     */
    @GetMapping("api/v1.0/menu/findAll")
    public ResultState findAll();

    /**
     * 根据用户ID查询其角色下关联的资源清单树信息
     *
     * @param userId
     * @return
     */
    @GetMapping("api/v1.0/menu/findAllByUserId/{userId}")
    public ResultState findAllByUserId(@PathVariable("userId") Long userId);

    @GetMapping("api/v1.0/user/record/visit/totals")
    public void recordLoginCount(@RequestParam(value = "userName") String userName,
                                 @RequestParam(value = "name") String name);
}
